package com.example.pclimb.model;

import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import androidx.room.Ignore;

import java.util.Date;

/**
 * 旅游攻略实体类
 */
@Entity(tableName = "travel_guides",
        foreignKeys = @ForeignKey(entity = User.class,
                parentColumns = "id",
                childColumns = "authorId",
                onDelete = ForeignKey.CASCADE),
        indices = @Index("authorId"))
public class TravelGuide {
    @PrimaryKey(autoGenerate = true)
    private int id;
    private int authorId; // 作者ID
    private String title; // 标题
    private String content; // 内容
    private String location; // 相关地点
    private Date publishDate; // 发布日期
    private int viewCount; // 查看次数
    private int likeCount; // 点赞次数
    private String imageUrls; // 图片URL，多个URL用逗号分隔

    @Ignore
    public TravelGuide() {
    }

    public TravelGuide(int authorId, String title, String content, String location, String imageUrls) {
        this.authorId = authorId;
        this.title = title;
        this.content = content;
        this.location = location;
        this.imageUrls = imageUrls;
        this.publishDate = new Date();
        this.viewCount = 0;
        this.likeCount = 0;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getAuthorId() {
        return authorId;
    }

    public void setAuthorId(int authorId) {
        this.authorId = authorId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public int getViewCount() {
        return viewCount;
    }

    public void setViewCount(int viewCount) {
        this.viewCount = viewCount;
    }

    public int getLikeCount() {
        return likeCount;
    }

    public void setLikeCount(int likeCount) {
        this.likeCount = likeCount;
    }

    public String getImageUrls() {
        return imageUrls;
    }

    public void setImageUrls(String imageUrls) {
        this.imageUrls = imageUrls;
    }
} 